const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");

module.exports = {
  mode: "development",
  devtool: "eval-source-map",
  devServer: {
    contentBase: path.resolve(__dirname, "./dist"),
    port: 3011,
  },
  entry: path.resolve(__dirname, "./main.js"),
  output: {
    path: path.resolve(__dirname, "./dist"),
    filename: "[hash].js",
    // publicPath: '/static/'
  },
  resolve: {
    extensions: [".ts", ".js", ".obj"],
  },
  module: {
    rules: [
      {
        test: /\.ts$/,
        use: [
          {
            loader: "ts-loader",
          },
        ],
      },
      {
        test: /\.(gif|png|jpg|obj|fbx|glb|gltf|ply|hdr)$/,
        use: [
          {
            loader: "url-loader",
          },
        ],
      }
    ],
  },
  plugins: [
    new HtmlWebpackPlugin({
      template: path.resolve(__dirname, "./public/index.html"),
      filename: "index.html",
    }),
  ],
};
